import { createRouter, createWebHashHistory } from 'vue-router'


// Vue.use(VueRouter)

// export default new VueRouter({
// 	mode: 'history',
// 	routes: [
// 		{ path: '/', component: () => import('views/index') },
// 		{ path: '/index', redirect: '/' },
// 		// { path: '/come', component: require('views/come') },
// 		// { path: '/pirates', component: require('views/pirates') },
// 		// { path: '/about', component: require('views/about') },
// 		// { path: '/sky', component: require('views/sky') },
// 		// { path: '/hero/:id', component: require('views/hero') }
// 	]
// })


const router = createRouter({
  // 更改路由链接激活项的类名
  // linkActiveClass: 'router-active',
  history: createWebHashHistory(),


  // 3. 命名路由
  routes: [
    { path: '/',redirect: '/index'},
    { path: '/index', component: () => import('../views/index.vue')},
    // { path: '/shengxian', component: () => import('../components/piratesContent.vue') },
    // { path: '/about', component: () => import('../components/piratesContent.vue') },
    { path: '/come', component: () => import('../components/piratesContent.vue') },
    { path: '/suit', component: () => import('../views/suit.vue') },
    { path: '/robe', component: () => import('../views/robe.vue') },
    { path: '/bclothing', component: () => import('../views/bclothing.vue') },
    { path: '/accessory', component: () => import('../views/accessory.vue') },
    { path: '/fan', component: () => import('../views/fan.vue') },
    { path: '/cufflink', component: () => import('../views/cufflink.vue') },
    { path: '/pendant', component: () => import('../views/pendant.vue') }
    // { path: '/shortcut', component: () => import('../components/common/XtxShortCut.vue') },

    // {
      // path: '/movie',
      // component: () => import ('./components/Movie.vue'),
      // children: [
        // { path: ':id', name: 'MovieDetails', component: () => import ('./components/movieDetails.vue'), props: true }
      // ]
    // },
    // 导航守卫-登录组件
    // { path: '/login', name: 'Login', component: () => import ('./components/Login.vue') }
  ]
})

// 注册全局导航守卫
// router.beforeEach((to, from, next) => {
//   let isLogin = false
//   if (to.name == 'MovieDetails') {
//     if (isLogin) {
//       next()
//     } else {
//       next({ name: 'Login' })
//     }
//   } else {
//     next()
//   }
// })

export default router
